﻿using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;

namespace ElectricityMate
{
    public partial class SettingsPage : PhoneApplicationPage
    {
        public SettingsPage()
        {
            InitializeComponent();
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Flashes.Text = App.ViewModel.FlashesPerKWh.ToString();
            base.OnNavigatedTo(e);
        }
        private void Flashes_OnTextChanged(object sender, TextChangedEventArgs e)
        {
            int flashes;
            if (int.TryParse(Flashes.Text, out flashes))
            {
                App.ViewModel.FlashesPerKWh = flashes;
            }
        }

    }
}